package com.sport.facilities.booking.system.ui;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

public class DialogHelper {
	public static AlertDialog getOkAlertDialog(Context ctx,String title,String message){
		AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
		builder.setTitle(title);
		builder.setMessage(message);
		builder.setNegativeButton("OK", new OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				dialog.cancel();
			}
		});
		AlertDialog alertDialog = builder.create();
		return alertDialog;
	}
	
	public static AlertDialog getOkAlertDialog(Context ctx,String title,String message,final YesAction action){
		AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
		builder.setTitle(title);
		builder.setMessage(message);
		builder.setNegativeButton("OK", new OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				action.fnDoYesAction();
				dialog.cancel();
			}
		});
		AlertDialog alertDialog = builder.create();
		return alertDialog;
	}
	
	public static AlertDialog getYesNoDialog(Context ctx,String title,String message,final YesAction action){
		AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
		builder.setTitle(title);
		builder.setMessage(message);
		builder.setCancelable(false);
		builder.setNegativeButton("No", new OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				dialog.cancel();
			}
		});
		builder.setPositiveButton("Yes", new OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				action.fnDoYesAction();
			}
		});
		AlertDialog alertDialog = builder.create();
		return alertDialog;
	}
	
	

	public static AlertDialog getOkActionDialog(Context ctx,String title,String message,final YesAction action){
		AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
		builder.setTitle(title);
		builder.setMessage(message);
		builder.setCancelable(false);

		builder.setPositiveButton("OK", new OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				action.fnDoYesAction();
			}
		});
		AlertDialog alertDialog = builder.create();
		return alertDialog;
	}
	
	
	
}
